package com.lzx.demo.bloodpressurehelper.fragment.home;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

/**
 * Created by admin on 2016/10/25.
 */
public class MyHomeFragmentPageAdapter extends FragmentPagerAdapter {

    private final int PAGE_COUNT = 2;

    private Fragment fgRemeBloodPressure;
    private Fragment fgCheckBloodPressure;

    public MyHomeFragmentPageAdapter(FragmentManager fm) {
        super(fm);
        fgRemeBloodPressure = new RememBloodPressureFragment();
        fgCheckBloodPressure = new CheckBloodPressureFragment();
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        switch (position){
            case 0:
                fragment = fgRemeBloodPressure;
                break;
            case 1:
                fragment = fgCheckBloodPressure;
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return PAGE_COUNT;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        super.destroyItem(container, position, object);
    }
}
